﻿@using System.Collections.Generic

@{
    IAsyncEnumerable<bool> GetAsyncEnumerable()
    {
        return null;
    }

    await foreach (var val in GetAsyncEnumerable())
    {

    }

    Range range = 1..5;
    using var disposable = GetLastDisposableInRange(range);

    var words = Array.Empty<string>();
    var testEnum = GetEnum();
    static TestEnum GetEnum()
    {
        return TestEnum.First;
    }
}

@words[1..2]
@(words[^2..^0])

@(testEnum switch
{
    TestEnum.First => "The First!",
    TestEnum.Second => "The Second!",
    _ => "The others",
})

@await foreach (var val in GetAsyncEnumerable())
{
    @val
}

@Person!.Name
@People![0]!.Name![1]
@DoSomething!(Person!)

@functions {
    enum TestEnum
    {
        First,
        Second
    }

    IDisposable GetLastDisposableInRange(Range range)
    {
        var disposables = (IDisposable[])ViewData["disposables"];
        return disposables[range][^1];
    }

    private Human? Person { get; set; }

    private Human?[]? People { get; set; }

    private Func<Human, string>? DoSomething { get; set; }

    private class Human
    {
        public string? Name { get; set; }
    }
}